//
//  MemoryStepTastViewController.m
//  安好
//
//  Created by 马晓良 on 14-11-27.
//  Copyright (c) 2014年 lianchuangbrother. All rights reserved.
//

#import "MemoryStepTastViewController.h"
#import "HealthRecordLogInfoCell.h"
#import "EditImportSignsViewController.h"
#import "DataSourceViewController.h"
@interface MemoryStepTastViewController ()<UITableViewDataSource,UITableViewDelegate>
/**
 *  记步任务tableView
 */
@property (strong, nonatomic) IBOutlet UITableView *memoryStepTastTableView;

@end

@implementation MemoryStepTastViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.memoryStepTastTableView.dataSource = self;
    self.memoryStepTastTableView.delegate = self;
    [self setNaviBarAttribute];
    self.memoryStepTastTableView.backgroundColor = [ClassMethodsViewController colorWithHexString:BACK_BACKGROUNDCOLOR_16];
    self.navigationItem.title = @"记步任务";
    // Do any additional setup after loading the view from its nib.
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
//    self.navigationController.navigationBar.translucent = NO;
}

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
//    self.navigationController.navigationBar.translucent = YES;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - 设置naviBar 并实现左右naviBar button方法 -
- (void)setNaviBarAttribute{
    /**
     *  设置左NaviBar和右naviBar
     */
    UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    leftButton.frame = CGRectMake(0, 0, 23, 23);
    [leftButton setImage:[UIImage imageNamed:@"公用_返回"] forState:UIControlStateNormal];
    [leftButton addTarget:self action:@selector(handleLeftButtonAction) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
    self.navigationItem.leftBarButtonItem = leftBarButtonItem;
}

/**
 *  返回主页面
 */
- (void)handleLeftButtonAction{
    [self.navigationController popViewControllerAnimated:YES];
}


#pragma mark - tableView的代理方法 -
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return 1;
    }
//    else if (section == 1){
//        return 1;
//    }
    return 0;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
//    return 2;
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 10;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.1;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *indentify = @"healthRecordLogInfoCell";
    HealthRecordLogInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:indentify];
    if (!cell) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"HealthRecordLogInfoCell" owner:self options:nil] lastObject];
    }
    if (indexPath.section == 0) {
//        cell.healthRecordInfoLabel.text = @"数据来源";
        cell.healthRecordInfoLabel.text = @"查看全部数据";
    }
//    else if (indexPath.section == 1){
//        cell.healthRecordInfoLabel.text = @"查看全部数据";
//    }
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
//    if (indexPath.section == 1) {
        EditImportSignsViewController *editImportSignsVC = [[EditImportSignsViewController alloc] init];
        editImportSignsVC.naviTitleStr = [NSString stringWithFormat:@"记步记录"];
        [self.navigationController pushViewController:editImportSignsVC animated:YES];
//    }
//    else{
//        DataSourceViewController *dataSourceVC = [[DataSourceViewController alloc] init];
//        [self.navigationController pushViewController:dataSourceVC animated:YES];
//    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
